﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Runtime.InteropServices;
using UnityEngine.UI;

public class AudioAgent : MonoBehaviour {


	void Start()
	{
		WebAudioManager.instance.RequestSound("Audio/bg.mp3");
		WebAudioManager.instance.RequestSound("Audio/owl.mp3");
		WebAudioManager.instance.RequestSound("Audio/pig.mp3");
		WebAudioManager.instance.RequestSound("Audio/spider.mp3");
	}

	int status = 0; //0, init; 1, game started; 2, gameing

	public void StartGame()
	{
		if (status == 0) {
			WebAudioManager.instance.PlaySoundImmdiately ("Audio/bg.mp3", 1);
			status = 1;
		}
	}
	
	public void Play1()
	{
		WebAudioManager.instance.PlaySoundImmdiately ("Audio/pig.mp3", 0);
	}

	public void Play2()
	{
		WebAudioManager.instance.PlaySoundImmdiately ("Audio/owl.mp3", 0);
	}

	public void Play3()
	{
		WebAudioManager.instance.PlaySoundImmdiately ("Audio/spider.mp3", 0);
	}
}
